package user_partner_reward

import (
	"context"

	"gitee.com/liuxuezhan/ar-platform/rpc-client/assetsClient/rpc"

	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserPartnerRewardsDelLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// 删除
func NewUserPartnerRewardsDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserPartnerRewardsDelLogic {
	return &UserPartnerRewardsDelLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *UserPartnerRewardsDelLogic) UserPartnerRewardsDel(req *types.UserPartnerDelRequest) (resp *types.UserPartnerDelResponse, err error) {
	info, err := l.svcCtx.AssetsRpc.User.UserPartnerRewardsDel(l.ctx, &rpc.UserPartnerDelRequest{
		Id:     req.Id,
		UserId: req.UserId,
	})
	if err != nil {
		return &types.UserPartnerDelResponse{
			IsDel: false,
		}, err
	}
	return &types.UserPartnerDelResponse{
		IsDel: info.IsDel,
	}, nil
}
